package com.security.web.rest.async;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * ${DESCRIPTION}
 *
 * @author roger
 * @email 190642964@qq.com
 * @create 2017-11-02 11:50
 **/
@Component
public class MockQueue {

    private Logger logger = LoggerFactory.getLogger(getClass());

    private String paceOrder;

    private String completeOrder;

    public String getPaceOrder() {
        return paceOrder;
    }

    public void setPaceOrder(String paceOrder) throws Exception {
        new Thread(() -> {
            logger.info("接到下单请求 ： " + paceOrder);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            this.completeOrder = paceOrder;
            logger.info("下单请求处理完毕 ： " + paceOrder);
        }).start();
    }

    public String getCompleteOrder() {
        return completeOrder;
    }

    public void setCompleteOrder(String completeOrder) {
        this.completeOrder = completeOrder;
    }
}
